﻿
Imports Moca.Db

Namespace Db.Impl

	''' <summary>
	''' DaoGroup データアクセス
	''' </summary>
	''' <remarks></remarks>
	Public Class DaoGroup
		Inherits AbstractDao
		Implements IDaoGroup

		Public Function GetAll() As IList(Of GroupEntity) Implements IDaoGroup.GetAll
			Const C_SQL As String = "IDaoGroup_GetAll"

			Using cmd As IDbCommandStoredProcedure = CreateCommandStoredProcedure(C_SQL)
				Return cmd.Execute(Of GroupEntity)()
			End Using
		End Function

		Public Sub Add(value As GroupEntity) Implements IDaoGroup.Add
			Const C_SQL As String = "IDaoGroup_Add"

			Using cmd As IDbCommandStoredProcedure = CreateCommandStoredProcedure(C_SQL)
				cmd.AddParameterValue(value.Name)

				cmd.ExecuteNonQuery()
			End Using
		End Sub

		Public Sub Upd(value As GroupEntity) Implements IDaoGroup.Upd
			Const C_SQL As String = "IDaoGroup_Upd"

			Using cmd As IDbCommandStoredProcedure = CreateCommandStoredProcedure(C_SQL)
				cmd.AddParameterValue(value.Id)
				cmd.AddParameterValue(value.Name)

				cmd.ExecuteNonQuery()
			End Using
		End Sub

		Public Sub Del(value As GroupEntity) Implements IDaoGroup.Del
			Const C_SQL As String = "IDaoGroup_Del"

			Using cmd As IDbCommandStoredProcedure = CreateCommandStoredProcedure(C_SQL)
				cmd.AddParameterValue(value.Id)

				cmd.ExecuteNonQuery()
			End Using
		End Sub

	End Class

End Namespace
